// INCLUDES --------------------------------------------------------------------------
#include "MainFramework.h"

// HELPER FUNCTIONS ------------------------------------------------------------------
static fp32 currentFPS = 0.0f;
void calculateFPS()
{
}

// VARIABLES -------------------------------------------------------------------------
static bool renderMode = true; // should rendering continue?

// FUNCTIONS -------------------------------------------------------------------------

void renderSomePot()
{
  // TEMP!!!
  static float r = 0.0f;
  glPushMatrix();
    glTranslatef(0.0f, 0.0f, -10.0);
    glRotatef(r, 0.0f, 1.0f, 0.0f);
    glutSolidTeapot(1.0);
  glPopMatrix();

  r+=0.1f;
}

// main engine init
void Init()
{
  RenderInit();
};

// main engine computation
void Compute()
{
  if (renderMode == true) RenderInvalidate(); // re-render scene
};

int i = 0;
// main engine render
void Render()
{
  // clear screen
  RenderClear();

  renderSomePot();
  
  // swap buffers
  RenderSwapBuffers();
};

// event callbacks: window reshape, window status update, keyboard/mouse input
void Window(i32 width, i32 height)
{
  // TODO: needs to use CAMERA!!!

  // setup the viewport
  RenderViewport((ui32)width, (ui32)height);
};

void WindowStatus(i32 state)
{
  // check for window status
  switch (state)
  {
#ifdef GLUT
    case GLUT_HIDDEN:
    case GLUT_FULLY_COVERED:
      renderMode = false;
      break;
#endif
    // default: render scene
    default:
    {
      renderMode = true;
      break;
    }
  };
};

void Keyboard(ub8 key, i32 x, i32 y)
{
};

void Mouse(i32 button, i32 state, i32 x, i32 y)
{
};
